Skip to content

Conversation

@nandorKollar
Copy link
Contributor

This pull request addresses two topics:

  • write logical type in parquet tools meta besides original type
  • take to UTC normalized parameter into account when printing time/timestamp values (using stringifiers)

"TIMESTAMP_MICROS_STRINGIFIER", "yyyy-MM-dd'T'HH:mm:ss.SSS z", timeZone) {
@Override
public String stringify(long value) {
return super.stringify(value) + String.format("%03d", Math.abs(value % 1000));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work as intended? It seems to me that it appends the micros after the already stringified millis-timestamp, but that does not end in the millis, but in the time zone instead (yyyy-MM-dd'T'HH:mm:ss.SSS z).

I would expect this to print something like "2018-08-17T07:41:12.345 America/Los_Angeles678".

}
};

static PrimitiveStringifier createTimestampStringifier(final LogicalTypeAnnotation.TimeUnit timeUnit, final boolean isAdjustedToUTC) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since others may use this code as a reference for proper timestamp-handling, I think it would better to use the correct types (Instant for UTC-normalized and LocalDateTime for non-UTC-normalized) instead of just printing the timestamps correctly.

@nandorKollar nandorKollar changed the title PARQUET-1383: Parquet tools should print logical type instead of (or besides) original type PARQUET-1383: Parquet tools should indicate UTC parameter for time/timestamp types Sep 12, 2018
PrimitiveStringifier stringifier = PrimitiveStringifier.TIMESTAMP_MILLIS_STRINGIFIER;

assertEquals("1970-01-01T00:00:00.000", stringifier.stringify(0l));
assertEquals("1970-01-01T00:00:00.000+0000", PrimitiveStringifier.TIMESTAMP_MILLIS_UTC_STRINGIFIER.stringify(0l));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you make this more consistent? Currently one stringifier is in a local variable, while the other is referenced directly.

@zivanfi zivanfi merged commit cded3e5 into apache:master Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants